PROGRAM_NAME=libmsdrmjni
CFLAGS_SHARE=-shared -fPIC

USER_INCLUDE:=/usr/local/include/
USER_LIB:=/usr/local/lib/

JAVA_HOME=/usr/lib/jdk/jdk1.8.0_161
JNI_INCLUDE=-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux 

D_LIBMSLOG_LIBS :=-L/usr/local/lib -lmslog
D_LIBMSLOG_INCLUDES :=-I/usr/local/include -I/usr/local/include/libmslog
D_LIBMSCOMMON_LIBS :=-L/usr/local/lib -lmscommon
D_LIBMSCOMMON_INCLUDES :=-I/usr/local/include -I/usr/local/include/libmscommon
D_LIBMSPROTOCOL_LIBS :=-L/usr/local/lib -lmsprotocol
D_LIBMSPROTOCOL_INCLUDES :=-I/usr/local/include -I/usr/local/include/libmsprotocol
D_LIBMSDRM_LIBS :=-L/usr/local/lib -lmsdrm
D_LIBMSDRM_INCLUDES :=-I/usr/local/include -I/usr/local/include/libmsdrm


C_INCLUDE=${D_BASEAPI_FLAGS}  ${D_LIBMSLOG_INCLUDES} ${D_LIBMSCOMMON_INCLUDES} ${D_LIBMSPROTOCOL_INCLUDES} ${D_LIBMSDRM_INCLUDES}
C_LIBS=${D_LIBMSLOG_LIBS} ${D_LIBMSCOMMON_LIBS} ${D_LIBMSPROTOCOL_LIBS} ${D_LIBMSDRM_INCLUDES} 


libmsdrmjni_CC=${CC}
libmsdrmjni_SRC=msdrmjni.c
libmsdrmjni_CFLAGS=${C_INCLUDE} ${C_LIBS} ${CFLAGS_SHARE} ${JNI_INCLUDE} 


all:libmsdrmjni 

libmsdrmjni: 
	cp include/* 	${USER_INCLUDE} -fr
	cp lib/* 	${USER_LIB} 	-fr
	ldconfig
	$($@_CC)  $($@_SRC)  $($@_CFLAGS)  -o $@.so 
	cp $@.so  ${USER_LIB} 

clean:
	rm *.so
help:
	@echo "USAGE:make target"
	@echo "    libmsdrmjni      Produce the ${PROGRAM_NAME}.so"

